package com.boot.netty.server;

import com.boot.netty.server.listener.ServerListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import javax.annotation.Resource;

@Slf4j
@ComponentScan(basePackages = {"com.boot.netty.*"})
@SpringBootApplication
public class NettyServerApplication implements CommandLineRunner {

    @Resource
    private ServerListener serverListener;

    public static void main(String[] args) {
        SpringApplication.run(NettyServerApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        this.serverListener.startNettyServer();
    }
}
